feat(core-cffi-hello): add cffi cffi-gen-src sample#78
Merged
Conversation
Adds a scikit-build-core sample using cffi 2.1's new cffi-gen-src CLI to generate the extension source at build time, mirroring the meson-python example in the cffi docs. Gated to Python 3.10+ in the noxfile since cffi 2.1 requires it. Assisted-by: ClaudeCode:claude-fable-5
Replaces the exec-python builder script with separate .cdef.txt/.csrc.c inputs, the recommended form for build-system integration. Assisted-by: ClaudeCode:claude-fable-5
cffi's generated source defines Py_LIMITED_API itself on MSVC release builds, making pyconfig.h auto-link python3.lib, which fails when CMake links the version-specific library. Lean in and build a proper abi3 wheel via wheel.py-api + USE_SABI. Assisted-by: ClaudeCode:claude-fable-5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Adds
core-cffi-hello, a scikit-build-core sample for cffi 2.1's newcffi-gen-srcCLI — the scikit-build-core analog of the meson-python example in the cffi docs.read-sourcesmode: the FFI definitions (_hello.cdef.txt) and C prelude (_hello.csrc.c) are separate files fed topython -m cffi.gen_srcin anadd_custom_command; the generated_hello.cis compiled with the plain C library viapython_add_library. Compile/link flags live in CMake sincecffi-gen-srcignoresset_source()-stylelibraries=/include_dirs=arguments.cffistays a runtime dependency (_cffi_backend); the cdef/csrc inputs are excluded from the wheel but ship in the sdist.license = "MIT"expression instead of a classifier.noxfile.py(cffi 2.1's floor), following thehello-free-threadingpattern; listed in the top-level README and AGENTS.md.Verified locally beyond CI: wheel/sdist contents inspected (cdef/csrc excluded from wheel,
License-Expression: MITin METADATA).